#include<bits/stdc++.h>
using namespace std;
signed main() {

    string s;
    cin >> s;

    vector<char> arr;
    for(auto i : s)
        if(find(arr.begin(), arr.end(), i) == arr.end())
            arr.push_back(i);

    sort(arr.begin(), arr.end(), greater<char>());

    cout << "int[] arr = new int[]{";
    for(int i = 0; i < arr.size(); i++) {
        if(!i)
            cout << arr[i];
        else
            cout << "," << arr[i];
    }
    cout << "};\n";

    vector<int> idx;
    for(auto i : s) {
        idx.push_back(find(arr.begin(), arr.end(), i) - arr.begin());
    }

    cout << "int[] index = new int[]{";
    for(int i = 0; i < idx.size(); i++) {
        if(!i)
            cout << idx[i];
        else
            cout << "," << idx[i];
    }
    cout << "};";

    return 0;
}

